#!/usr/bin/perl
package Wallpaper::Main;
$VERSION = sprintf "%.3f", 1 + substr(q$Revision: 159 $,9)/1000;

require Exporter;
@ISA       = qw( Exporter );
@EXPORT_OK = qw($mux $sock $version mux_connection);

use strict;

# "Real" Modules
use IO::Socket;
use IO::Multiplex;

our ( $version ) = ( q/$Revision: 159 $/ ) =~ /(\d+)/g;

our $mux = new IO::Multiplex;

unlink( '/tmp/wallpaper_socket' );    # Kill it !

my $sock = IO::Socket::UNIX->new( Local  => '/tmp/wallpaper_socket',
                                  Type   => SOCK_STREAM,
                                  Listen => 5
                                ) or die "Could not create socket: $!\n";

$mux->listen( $sock );
$mux->set_callback_object( __PACKAGE__ );

sub mux_connection {
    my $package = shift;
    my $mux     = shift;
    my $fh      = shift;

    # Construct a new client object
    Wallpaper::Client->new( $mux, $fh );

} ## end sub mux_connection

1;

